
<?php

Class Login_model extends CI_Model {

    function login($data) {
        $username = $data['username'];
        $password = $data['password'];
        $this->db->select('*');
        $this->db->from('url_users');
        $this->db->where('username', $username);
        $this->db->where('password', $password);
        $this->db->where('status', 'active');
        $query = $this->db->get();

        if ($query->num_rows() == 1) {
            return $query->result();
        } else {
            $this->session->set_flashdata('msg', 'Authentication Fail');
            redirect(base_url());
        }
    }
    function Check_email($data){
        //print_r($data);
        $this->db->get_where('url_users', $data);
        return $this->db->affected_rows();
       
    }
    function changePassword($data){
        $email=$data['email'];
        //print_r($data);
        //print_r($data); die;
        $data = array('password' => $data['password']);
         //print_r($data); die;
        $this->db->where('email', $email);
        $this->db->update('url_users', $data);
        return $this->db->affected_rows();
        
        
    }
    

}
?>


